package com.xxx.modules.sys.controller;

import com.xxx.common.utils.R;
import com.xxx.modules.sys.service.UserTextSupportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**文章点赞 Controller
 * Created by ChenXuefei on 2017/10/17.
 */
@RestController
@Slf4j
public class SysUserTextSupportController {

    @Autowired
    private UserTextSupportService userTextSupportService;

    @RequestMapping("sys/user/attention/add")
    public R addUserTextSupportService(String supportId, String textId){
        userTextSupportService.addUserTextSupport(supportId,textId);
        log.debug("【"+supportId+" 点赞了 "+textId+"】");
        return R.ok();
    }

    /**
     * 取消点赞
     * @param supportId
     * @param textId
     * @return
     */
    @RequestMapping("sys/user/attention/delete")
    public R deleteUserTextSupportService(String supportId,String textId){
        userTextSupportService.updateUserTextSupport(supportId,textId);
        log.debug("【"+supportId+" 取消点赞 "+textId+"】");
        return R.ok();
    }
}
